//
// Created by maicss on 22-4-18.
//

#ifndef FOLDERSHARE_GUI_MAINWINDOW_H
#define FOLDERSHARE_GUI_MAINWINDOW_H

#include <QMainWindow>
#include <QMouseEvent>
#include "widgets/TitleBar.h"
#include <QLabel>
#include <QImage>
#include <QStackedWidget>
#include <QLineEdit>
#include <QCheckBox>
#include <QProcess>
#include <QList>
#include <QComboBox>

struct Network{
    QString ip;
    QString name;
};


class MainWindow : public QMainWindow{
    Q_OBJECT
public:
    MainWindow();

    void setPath(const QString& path);
    QImage setQRCode(const QString& context);
    void startServer();
    void stopServer();
    void updateNetworks();
    ~MainWindow();
    void openUrl(QString url);
    void initUI();

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;

private:
    bool m_isDrag;
    QPoint m_mousePoint;
    QPoint m_windowPoint;
    TitleBar titleBar;
    QLabel m_pathshow;
    QLabel m_qrcodeshow;
    QStackedWidget m_stk;
    QWidget m_page_show;
    QPushButton m_btn_openServer;
    QLineEdit m_lineEdit;
    QCheckBox m_allowUpload;
    QCheckBox m_allowDownloadFolder;
    QProcess m_process;
    QString m_path;
    QList<Network> networks;
    QComboBox m_comboBox;
    bool isOpen;
    QLabel m_tip;
};


#endif //FOLDERSHARE_GUI_MAINWINDOW_H
